<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>if判断</title>
	</head>
	<body>
		<button type="button" onclick="number()">判断是否能被2整除</button>
		<script type="text/javascript">
			var i = 0;
			function number(){
				// i++   i=i+1  在自身上面加1
				i++;
				//%取余  余数==0 能被2整除
				//if 如果
				if(i%2 == 0){
					console.log(i,"能被2整除");
				}else{//否则
					console.log(i,"不能被2整除");
				}
			}
		</script>
	</body>
</html>
